package br.ufu.lsi.database.factory;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicCounter {
    
    private AtomicInteger c = new AtomicInteger(0);

   
    public int value() {
        
        int count = c.get();
        if( count >= TwitterBuilder.twitterKeys.length ) {
            c.set( 0 );
        } else {
            return c.getAndIncrement();
        }
            
        return c.get();
    }
    
    public int getCounter() {
        return c.get();
    }

}